home *** CD-ROM | disk | FTP | other *** search
- #include "bbs.h"
- #include <graphics/displayinfo.h>
- #include <intuition/intuition.h>
- #include <graphics/gfxbase.h>
- #include <intuition/imageclass.h>
- #include <clib/graphics_protos.h>
- #include <clib/intuition_protos.h>
-
- #include <exec/types.h>
- #include "express.h"
- #include "myinfo.h"
- #include <intuition/classes.h>
- #include <intuition/classusr.h>
- #include <intuition/gadgetclass.h>
- #include <libraries/gadtools.h>
- #include <clib/exec_protos.h>
- #include <clib/gadtools_protos.h>
- #include <clib/utility_protos.h>
- #include <string.h>
-
- void StripIntuiMessages( struct MsgPort *mp, struct Window *win );
-
- struct TextAttr Topaz8 = { ( STRPTR )"topaz.font", 8, 0x00, 0x00 };
- WORD DIM[5] = { 1,1,270,11 };
- UWORD DriPens[] = { 0,1,1,1,6,4,1,0,4,1,4,1, 65535 };
- UWORD ScreenCols[] = { 0,0x0,0x0,0x0, // black
- 1,0xf,0xf,0xf, // white
- 2,0x0,0xf,0x0, // green
- 3,0xf,0xf,0x0, // yellow
- 4,0x0,0x0,0xf, // blue
- 5,0xf,0x0,0xf, // purple
- 6,0x0,0xf,0xf, // cyan
- 7,0xf,0x0,0x0, // red
- 65535,0x0,0x0,0x0 }; // ------
-
- void PrintAddress(ULONG t);
- void CloseAEStats(void);
- //extern __far struct Library *DOSBase;
- static int InitZmodemCon(void)
- {
- ZmodemWritePort=CreatePort("zmwriteport",0l);
- ZmodemWriteReq=CreateStdIO(ZmodemWritePort);
- ZmodemWriteReq->io_Data=(APTR)ZmodemStatsWin;
- //ZmodemWriteReq->io_Length=sizeof(*ZmodemStatsWin);
- return((int)OpenDevice("console.device",3L,ZmodemWriteReq,0L));
- }
- int OpenZDisplay(void)
- {
-
- if(!ICON) {
- ZmodemStats.Title=(UBYTE *)&ZModemInfo.TitleBar;
- ZmodemStatsWin = (struct Window *)OpenWindow(&ZmodemStats);
- InitZmodemCon();
- ZmodemStatPrint("H\x30\x20\x70H\n FileName:\n FileSize: 0\n APX Time:\n Position: 0\n Complete: 0%\n Resume P: 0\n\n LastTime: 0 Mins 0 Secs\n CPS: 0\n\n Z Status: Awaiting ACK\n ErrorPos: 0");
- }
- return(1);
- }
-
- void UpdateZDisplay(void)
- {
-
- /* transfer window not open */
- if(!ICON)
- {
- ZmodemStatPrint("H\x30\x20\x70");
- sprintf(GSTR1,"H\n FileName: %s\n",ZModemInfo.FileName);
- ZmodemStatPrint(GSTR1);
- sprintf(GSTR1," FileSize: %ld\n",ZModemInfo.Filesize);
- ZmodemStatPrint(GSTR1);
- sprintf(GSTR1," APX Time: %lu Mins %lu Secs\n",ZModemInfo.ApxTime/60L,ZModemInfo.ApxTime%60L);
- ZmodemStatPrint(GSTR1);
- ZmodemStatPrint(" Position: \n");
- ZmodemStatPrint(" Complete: \n");
- sprintf(GSTR1," Resume P: %ld\n\n",ZModemInfo.ResumePos);
- ZmodemStatPrint(GSTR1);
- sprintf(GSTR1," LastTime: %lu Mins %lu Secs\n",ZModemInfo.LastTime/60L,ZModemInfo.LastTime%60L);
- ZmodemStatPrint(GSTR1);
- sprintf(GSTR1," CPS: %ld Efficency %lu\n\n",ZModemInfo.Cps,ZModemInfo.Eff);
- ZmodemStatPrint(GSTR1);
- sprintf(GSTR1," Z Status: %s\n",ZModemInfo.ZStat);
- ZmodemStatPrint(GSTR1);
- sprintf(GSTR1," ErrorPos: %ld ",ZModemInfo.ErrorPos);
- ZmodemStatPrint(GSTR1);
- }
- }
-
- static void CloseZmodemConsole(void)
- {
- CloseDevice(ZmodemWriteReq);
- DeleteStdIO(ZmodemWriteReq);
- DeletePort(ZmodemWritePort);
- }
- void CloseAEStats(void)
- {
- CloseDevice(StatWriteReq);
- DeleteStdIO(StatWriteReq);
- DeletePort(StatWritePort);
- }
- void CloseZDisplay(void)
- {
-
- if(!ICON) {
- /* transfer window is open */
- CloseZmodemConsole();
- CloseWindow(ZmodemStatsWin);
- }
- }
-
- void InitStatCon(void)
- {
- StatWritePort=CreatePort("statwriteport",0l);
- StatWriteReq=CreateStdIO(StatWritePort);
- StatWriteReq->io_Data=(APTR)StatusPane;
- OpenDevice("console.device",3L,StatWriteReq,0l);
- }
-
-
- static int OpenConsole(void)
- {
- WriteConReq->io_Data = (APTR)MYwindow;
- WriteConReq->io_Length = sizeof(*MYwindow);
- GI1 = OpenDevice("console.device",3L,WriteConReq,0L);
- ReadConReq->io_Device = WriteConReq->io_Device;
- ReadConReq->io_Unit = WriteConReq->io_Unit;
- return(GI1);
- }
-
- static int InitConsole(void)
- {
- extern UBYTE conin[];
-
- if(DStatBar)
- InitStatCon();
-
- if (!(WriteConPort = CreatePort("con.write",0L))) return(FAILURE);
- if (!(WriteConReq = CreateStdIO(WriteConPort))) return(FAILURE);
-
- if (!(ReadConPort = CreatePort("con.read",0L))) return(FAILURE);
- if (!(ReadConReq = CreateStdIO(ReadConPort))) return(FAILURE);
- if (OpenConsole()) return(FAILURE);
-
- WriteConReq->io_Command = CMD_WRITE;
-
- ReadConReq->io_Command = CMD_READ;
- ReadConReq->io_Length = 1;
- ReadConReq->io_Data = (APTR)conin;
- SendIO(ReadConReq);
- return(FALSE);
- }
-
- #define SA_Interleaved (SA_Dummy + 0x0022)
-
- void OpenDisplay(void)
- {
- MYNewScreen.Depth=BitPlanes;
-
- if(BitPlanes!=0)
- {
- if ((MYScreen = (struct Screen *)OpenScreenTags(&MYNewScreen,
- SA_Pens,&DriPens[0],
- SA_Colors,&ScreenCols[0],
- SA_Font,&Topaz8,
- SA_Interleaved,1,
- TAG_DONE )) == NULL)
- ShutDown("Can't Open Screen");
- }
-
- PaneStatus.Flags=SIMPLE_REFRESH;
-
-
- if(BitPlanes!=0)
- {
- MYNewWindow.Flags = SIMPLE_REFRESH | BACKDROP | BORDERLESS;
- MYNewWindow.Screen=MYScreen;
- PaneStatus.Screen=MYScreen;
- CloseIt.Screen=MYScreen;
- ZmodemStats.Screen=MYScreen;
-
- } else {
-
- MYNewWindow.IDCMPFlags=CLOSEWINDOW;
- MYNewWindow.Flags = SIMPLE_REFRESH | ACTIVATE | WINDOWSIZING | WINDOWDRAG | WINDOWDEPTH | WINDOWCLOSE ;
- ZmodemStats.IDCMPFlags=CLOSEWINDOW;
- ZmodemStats.Type=WBENCHSCREEN;
- ZmodemStats.Flags = WINDOWCLOSE | SIMPLE_REFRESH | WINDOWDEPTH | WINDOWDRAG;
- PaneStatus.Flags = SIMPLE_REFRESH | WINDOWDRAG | WINDOWDEPTH;
- }
-
- if(DStatBar)
- {
- if (( StatusPane = (struct Window *)OpenWindow(&PaneStatus)) == NULL) ShutDown("Cant open windows");
- } else {
- StatusPane=NULL;
- }
-
- if(BitPlanes!=0)
- {
- drinfo=GetScreenDrawInfo(MYScreen);
- closeimage=(struct Image *) NewObject(
- NULL, "sysiclass",
- SYSIA_Size, 0,
- SYSIA_Which, CLOSEIMAGE,
- SYSIA_DrawInfo, drinfo,
- TAG_END);
-
- MG.Width=closeimage->Width;
- MG.Height=closeimage->Height;
- MG.GadgetRender=(APTR)closeimage;
- CloseIt.FirstGadget=(APTR)&MG;
- CloseIt.Width=MG.Width-1;
-
- } else {
-
- closeimage=NULL;
- drinfo=NULL;
- }
-
- if(BitPlanes!=0) if (( Iconify = (struct Window *)OpenWindow(&CloseIt)) == NULL) ShutDown("Cant open windows");
- if (( MYwindow = (struct Window *)OpenWindow(&MYNewWindow)) == NULL) ShutDown("Cant open windows");
-
- if(BitPlanes!=0)
- {
- if(Sopt->Toggles[6])
- {
- SetRGB4(&MYScreen->ViewPort,0,0x0,0x0,0x0);
- SetRGB4(&MYScreen->ViewPort,1,0xf,0x0,0x0);
- SetRGB4(&MYScreen->ViewPort,2,0x0,0xf,0x0);
- SetRGB4(&MYScreen->ViewPort,3,0xf,0xf,0x0);
- SetRGB4(&MYScreen->ViewPort,4,0x0,0x0,0xf);
- SetRGB4(&MYScreen->ViewPort,5,0xf,0x0,0xf);
- SetRGB4(&MYScreen->ViewPort,6,0x0,0xf,0xf);
- SetRGB4(&MYScreen->ViewPort,7,0xf,0xf,0xf);
- }
- }
-
- if(BitPlanes==0)
- {
- IconifySig=1L<<MYwindow->UserPort->mp_SigBit;
- } else {
- IconifySig=1L<<Iconify->UserPort->mp_SigBit;
- }
-
- InitConsole();
- ConCharSig=1L<<ReadConPort->mp_SigBit;
-
- if(DStatBar && BitPlanes)
- {
- SizeWindow(MYwindow,0,-28);
- MoveWindow(MYwindow,0,28);
- } else if(DStatBar)
- {
- SizeWindow(MYwindow,0,-38);
- MoveWindow(MYwindow,0,38);
- }
-
- }
-
-